// useLoadQuestionData
import { useEffect, useState } from "react"
import { useParams } from "react-router-dom"
import { useRequest } from "ahooks"
import { getQuestionService } from "../services/question"

function useLoadQuestionData() {
  const { id = "" } = useParams()
  //   const [loading, setLoading] = useState(true)
  //   const [questionData, setQuestionData] = useState({})
  //   useEffect(() => {
  //     async function fn() {
  //       const data = await getQuestionService(id)
  //       setQuestionData(data)
  //       setLoading(false)
  //     }
  //     fn()
  //   }, [])

  async function load(id) {
    const data = await getQuestionService(id)
  }

  const { loading, error, data } = useRequest()

  return { loading, questionData }
}
export default useLoadQuestionData
